import {lazy} from 'react'
import { Navigate } from 'react-router-dom'
import WrapperRouteComponent from './wrapperRouteComponent'
//路由懒加载
const Layout = lazy(()=>import("@/pages/layout"))
const Login = lazy(()=>import("@/pages/login"))
const NotFound  = lazy(()=>import("@/pages/404/NotFound"))
const System  = lazy(()=>import("@/pages/system"))
//dashboard嵌套路由
const Console  = lazy(()=>import("@/pages/dashboard/console"))
const  Monitor  = lazy(()=>import("@/pages/dashboard/monitor"))
const Workplace  = lazy(()=>import("@/pages/dashboard/workplace"))
//charts嵌套路由
const Bar  = lazy(()=>import("@/pages/charts/bar"))
const Pic  = lazy(()=>import("@/pages/charts/pic"))
//学生管理嵌套路由
const AdminClass =lazy(()=>import("@/pages/student/AdminClass"))
const AdminStu =lazy(()=>import("@/pages/student/AdminStu"))
const EditStudent = lazy(()=>import("@/pages/student/EditStudent"))
//新闻模块
const News = lazy(()=>import("@/pages/news"))
const EditNews = lazy(()=>import("@/pages/news/EditNews"))
const NewsDetail = lazy(()=>import("@/pages/news/NewsDetail"))


const routeList = [
    {
        path:'/',
       element: <Navigate to="/dashboard"></Navigate>
    },
    {
        path:'/dashboard',
       element: <WrapperRouteComponent element={<Layout/> } title="功能功能A" auth={true}/>,
       children:[
            {
                path:'',
                element:<Navigate to="console"/>
            },
            {
                path:'console',
                element:<WrapperRouteComponent element={<Console/> } title="功能功能A1" />
            },
            {
                path:'monitor',
                element:<WrapperRouteComponent element={<Monitor/> } title="功能功能A2" />
            },
            {
                path:'workplace',
                element:<WrapperRouteComponent element={<Workplace/> } title="功能功能A3" />
            }
       ]
    },
    {
        path:'/system',
       element: <WrapperRouteComponent element={<Layout/> } title="管理后台" auth={true}/>,
       children:[
            {
                path:'',
                element:<WrapperRouteComponent element={<System/> } title="用户" />
            }
       ]
    },
    //图表管理
    {
        path:'/charts',
       element: <WrapperRouteComponent element={<Layout/> } title="功能功能C" auth={true}/>,
       children:[
            {
                path:'bar',
                element:<WrapperRouteComponent element={<Bar/> } title="功能功能C1" />
            },
            {
                path:'pic',
                element:<WrapperRouteComponent element={<Pic/> } title="功能功能C2" />
            },
       ]
    },
    //学生管理
    {
        path:'/student',
       element: <WrapperRouteComponent element={<Layout/> } title="功能功能B" auth={true}/>,
       children:[
            {
                path:'adminclass',
                element:<WrapperRouteComponent element={<AdminClass/> } title="功能功能B1" />
            },
            {
                path:'adminstu',
                element:<WrapperRouteComponent element={<AdminStu/> } title="功能功能B2" />
            },
            {
                path:'editstudent',
                element:<WrapperRouteComponent element={<EditStudent/> } title="功能功能B3" />
            },
       ]
    },
    //新闻管理
    {
        path:'/news',
       element: <WrapperRouteComponent element={<Layout/> } title="功能功能D" auth={true}/>,
       children:[
            {
                path:'',
                element:<WrapperRouteComponent element={<News/> } title="功能功能D1" />
            },
            {
                path:'editNews',
                element:<WrapperRouteComponent element={<EditNews/> } title="新闻编辑" />
            },
            {
                path:'newsDetail',
                element:<WrapperRouteComponent element={<NewsDetail/> } title="新闻详情" />
            },
       ]
    },
    // 配置一些经常要用到的默认路由
    {
        path:'/login',
       element: <WrapperRouteComponent element={<Login/> } title="登录" />
    },
    {
        path:'/404',
       element: <WrapperRouteComponent element={<NotFound/> } title="404" />
    },
    {
        path:'*',
        element:<Navigate to='/404'></Navigate>
    }
]
export default routeList